package LoginPackage;

import static org.openqa.selenium.support.ui.ExpectedConditions.visibilityOfElementLocated;






import org.openqa.selenium.By;
import org.testng.annotations.*;

import PagePackage.MyPageFactory;
import PagePackage.internalPageClass;
import PagePackage.loginPageClass;
import PagePackage.newTeamPage;
import PagePackage.userRolePageClass;

public class EditTeam extends TestBaseClass {
	

	
	@Test (priority=0)
    public void AdminEditsBasketballTeam() {
	  goToMainPage(); 
	 
	  MyPageFactory.getPage(driver, loginPageClass.class).loginAs("victoria@krossover.com", "webmaster");
	  MyPageFactory.getPage(driver, userRolePageClass.class).clickTeamTab()
	  .findTeam("Basketball Team Edit")
	  .scrollAndClickTeam(0,0,"//*[text()='Basketball Team Edit']");
	   
	   wait.until(visibilityOfElementLocated(By.name("sport")));
	   MyPageFactory.getPage(driver, newTeamPage.class).chooseTeamSport("Football");
	   MyPageFactory.getPage(driver, newTeamPage.class).chooseLeagueSport("Football League")
		 .chooseSchoolSport("Football High School")
		 .addTeamName("Selenium Basketball University Team Edit")
		 .saveTeam()
	
	  .findTeam("Selenium Basketball University Team Edit")
	  .scrollAndClickTeam(0,0,"//*[text()='Selenium Basketball University Team Edit']");
	  
	  wait.until(visibilityOfElementLocated(By.name("sport")));
	  driver.findElement(By.xpath("//*[text()='Football']")).getAttribute("selected");
	  driver.findElement(By.xpath("//*[text()='Football League']")).getAttribute("selected");
	  driver.findElement(By.xpath("//*[text()='Football High School']")).getAttribute("selected");
	  
	  
	  
	   wait.until(visibilityOfElementLocated(By.name("sport")));
	   MyPageFactory.getPage(driver, newTeamPage.class).chooseTeamSport("Basketball");
	   MyPageFactory.getPage(driver, newTeamPage.class).chooseLeagueSport("Male Basketball League")
		 .chooseSchoolSport("Basketball University")
		 .addTeamName("Selenium Basketball University Team Edit")
		 .saveTeam()
		 .findTeam("Basketball Team Edit")
		  .scrollAndClickTeam(0,0,"//*[text()='Basketball Team Edit']");
	   
	   wait.until(visibilityOfElementLocated(By.name("sport")));
		  driver.findElement(By.xpath("//*[text()='Basketball']")).getAttribute("selected");
		  driver.findElement(By.xpath("//*[text()='Male Basketball League']")).getAttribute("selected");
		  driver.findElement(By.xpath("//*[text()='Basketball Team Edit']")).getAttribute("selected");
		  driver.get("https://www-dev.krossover.com/intelligence-qa/schools");
			 MyPageFactory.getPage(driver, internalPageClass.class).logout();
		
	  }
	
	@Test (priority=1)
    public void AdminEditsFootballTeam() {
	  goToMainPage(); 
	 
	  MyPageFactory.getPage(driver, loginPageClass.class).loginAs("victoria@krossover.com", "webmaster");
	  MyPageFactory.getPage(driver, userRolePageClass.class).clickTeamTab()
	   .findTeam("Football Team Edit")
	  .scrollAndClickTeam(0,0,"//*[text()='Football Team Edit']");
	   wait.until(visibilityOfElementLocated(By.name("sport")));
	   MyPageFactory.getPage(driver, newTeamPage.class).chooseTeamSport("Basketball");
	  
	   MyPageFactory.getPage(driver, newTeamPage.class).chooseLeagueSport("Male Basketball League")
		 .chooseSchoolSport("Basketball University")
		 .addTeamName("Selenium Football High School Team Edit")
		 .saveTeam()
	
	   .findTeam("Basketball Team Edit")
	  .scrollAndClickTeam(0,0,"//*[text()='Selenium Football High School Team Edit']");
	  
	  wait.until(visibilityOfElementLocated(By.name("sport")));
	  driver.findElement(By.xpath("//*[text()='Basketball']")).getAttribute("selected");
	  driver.findElement(By.xpath("//*[text()='Male Basketball League']")).getAttribute("selected");
	  driver.findElement(By.xpath("//*[text()='Basketball University']")).getAttribute("selected");
	  
	  
	  MyPageFactory.getPage(driver, newTeamPage.class).chooseTeamSport("Football")
	     .chooseLeagueSport("Football League")
		 .chooseSchoolSport("Football High School")
		 .addTeamName("Football Team Edit")
		 .saveTeam()
	
	   .findTeam("Football Team Edit")
	  .scrollAndClickTeam(0,0,"//*[text()='Football Team Edit']");
	  
	  wait.until(visibilityOfElementLocated(By.name("sport")));
	  driver.findElement(By.xpath("//*[text()='Football']")).getAttribute("selected");
	  driver.findElement(By.xpath("//*[text()='Football League']")).getAttribute("selected");
	  driver.findElement(By.xpath("//*[text()='Football High School']")).getAttribute("selected");
	 
	  driver.get("https://www-dev.krossover.com/intelligence-qa/schools");
		 MyPageFactory.getPage(driver, internalPageClass.class).logout();
	  }
	
	@Test (priority=2)
    public void AdminEditsLacrosseTeam() {
	  goToMainPage(); 
	  MyPageFactory.getPage(driver, loginPageClass.class).loginAs("victoria@krossover.com", "webmaster");
	  MyPageFactory.getPage(driver, userRolePageClass.class).clickTeamTab()
	  .findTeam("Lacrosse Team Edit")
	  .scrollAndClickTeam(0,0,"//*[text()='Lacrosse Team Edit']");
	   
	   wait.until(visibilityOfElementLocated(By.name("sport")));
	   MyPageFactory.getPage(driver, newTeamPage.class).chooseTeamSport("Basketball");
	   MyPageFactory.getPage(driver, newTeamPage.class).chooseLeagueSport("Male Basketball League")
		 .chooseSchoolSport("Basketball University")
		 .addTeamName("Selenium Lacrosse Other Team Edit")
		 .saveTeam()
	
	  .findTeam("Selenium Lacrosse Other Team Edit")
	  .scrollAndClickTeam(0,0,"//*[text()='Selenium Lacrosse Other Team Edit']");
	  
	  wait.until(visibilityOfElementLocated(By.name("sport")));
	  driver.findElement(By.xpath("//*[text()='Basketball']")).getAttribute("selected");
	  driver.findElement(By.xpath("//*[text()='Male Basketball League']")).getAttribute("selected");
	  driver.findElement(By.xpath("//*[text()='Basketball University']")).getAttribute("selected");
	  
	  
	  MyPageFactory.getPage(driver, newTeamPage.class).chooseTeamSport("Lacrosse");
	   MyPageFactory.getPage(driver, newTeamPage.class).chooseLeagueSport("Lacrosse League")
		 .chooseSchoolSport("Lacrosse Other")
		 .addTeamName("Lacrosse Team Edit")
		 .saveTeam()
	
	  .findTeam("Lacrosse Team Edit")
	  .scrollAndClickTeam(0,0,"//*[text()='Lacrosse Team Edit']");
	  
	  wait.until(visibilityOfElementLocated(By.name("sport")));
	  driver.findElement(By.xpath("//*[text()='Lacrosse']")).getAttribute("selected");
	  driver.findElement(By.xpath("//*[text()='Lacrosse League']")).getAttribute("selected");
	  driver.findElement(By.xpath("//*[text()='Lacrosse Other']")).getAttribute("selected");
	  
	  
	  
	  
      
	  driver.get("https://www-dev.krossover.com/intelligence-qa/schools");
		 MyPageFactory.getPage(driver, internalPageClass.class).logout();
	}	
	
	@Test (priority=3)
    public void SAEditsBasketballTeam() {
	  goToMainPage(); 
	 
	  MyPageFactory.getPage(driver, loginPageClass.class).loginAs("victoria@victoria.com", "webmaster");
	  MyPageFactory.getPage(driver, userRolePageClass.class).clickTeamTab()
	  .findTeam("Basketball Team Edit")
	  .scrollAndClickTeam(0,0,"//*[text()='Basketball Team Edit']");
	   
	   wait.until(visibilityOfElementLocated(By.name("sport")));
	   MyPageFactory.getPage(driver, newTeamPage.class).chooseTeamSport("Football");
	   MyPageFactory.getPage(driver, newTeamPage.class).chooseLeagueSport("Football League")
		 .chooseSchoolSport("Football High School")
		 .addTeamName("Selenium Basketball University Team Edit")
		 .saveTeam()
	
	  .findTeam("Selenium Basketball University Team Edit")
	  .scrollAndClickTeam(0,0,"//*[text()='Selenium Basketball University Team Edit']");
	  
	  wait.until(visibilityOfElementLocated(By.name("sport")));
	  driver.findElement(By.xpath("//*[text()='Football']")).getAttribute("selected");
	  driver.findElement(By.xpath("//*[text()='Football League']")).getAttribute("selected");
	  driver.findElement(By.xpath("//*[text()='Football High School']")).getAttribute("selected");
	  
	  
	  
	   wait.until(visibilityOfElementLocated(By.name("sport")));
	   MyPageFactory.getPage(driver, newTeamPage.class).chooseTeamSport("Basketball");
	   MyPageFactory.getPage(driver, newTeamPage.class).chooseLeagueSport("Male Basketball League")
		 .chooseSchoolSport("Basketball University")
		 .addTeamName("Selenium Basketball University Team Edit")
		 .saveTeam()
		 .findTeam("Basketball Team Edit")
		  .scrollAndClickTeam(0,0,"//*[text()='Basketball Team Edit']");
	   
	   wait.until(visibilityOfElementLocated(By.name("sport")));
		  driver.findElement(By.xpath("//*[text()='Basketball']")).getAttribute("selected");
		  driver.findElement(By.xpath("//*[text()='Male Basketball League']")).getAttribute("selected");
		  driver.findElement(By.xpath("//*[text()='Basketball Team Edit']")).getAttribute("selected");
		  driver.get("https://www-dev.krossover.com/intelligence-qa/schools");
			 MyPageFactory.getPage(driver, internalPageClass.class).logout();
		
	  }
	
	@Test (priority=4)
    public void SAEditsFootballTeam() {
	  goToMainPage(); 
	 
	  MyPageFactory.getPage(driver, loginPageClass.class).loginAs("victoria@victoria.com", "webmaster");
	  MyPageFactory.getPage(driver, userRolePageClass.class).clickTeamTab()
	  .findTeam("Football Team Edit")
	  .scrollAndClickTeam(0,0,"//*[text()='Football Team Edit']");
	   wait.until(visibilityOfElementLocated(By.name("sport")));
	   MyPageFactory.getPage(driver, newTeamPage.class).chooseTeamSport("Basketball");
	  
	   MyPageFactory.getPage(driver, newTeamPage.class).chooseLeagueSport("Male Basketball League")
		 .chooseSchoolSport("Basketball University")
		 .addTeamName("Selenium Football High School Team Edit")
		 .saveTeam()
	
	   .findTeam("Basketball Team Edit")
	  .scrollAndClickTeam(0,0,"//*[text()='Selenium Football High School Team Edit']");
	  
	  wait.until(visibilityOfElementLocated(By.name("sport")));
	  driver.findElement(By.xpath("//*[text()='Basketball']")).getAttribute("selected");
	  driver.findElement(By.xpath("//*[text()='Male Basketball League']")).getAttribute("selected");
	  driver.findElement(By.xpath("//*[text()='Basketball University']")).getAttribute("selected");
	  
	  
	  MyPageFactory.getPage(driver, newTeamPage.class).chooseTeamSport("Football")
	     .chooseLeagueSport("Football League")
		 .chooseSchoolSport("Football High School")
		 .addTeamName("Football Team Edit")
		 .saveTeam()
	
	   .findTeam("Football Team Edit")
	  .scrollAndClickTeam(0,0,"//*[text()='Football Team Edit']");
	  
	  wait.until(visibilityOfElementLocated(By.name("sport")));
	  driver.findElement(By.xpath("//*[text()='Football']")).getAttribute("selected");
	  driver.findElement(By.xpath("//*[text()='Football League']")).getAttribute("selected");
	  driver.findElement(By.xpath("//*[text()='Football High School']")).getAttribute("selected");
	 
	  driver.get("https://www-dev.krossover.com/intelligence-qa/schools");
		 MyPageFactory.getPage(driver, internalPageClass.class).logout();
	  }
	  
	
	@Test (priority=5)
    public void SAEditsLacrosseTeam() {
	  goToMainPage(); 
	 
	  MyPageFactory.getPage(driver, loginPageClass.class).loginAs("victoria@victoria.com", "webmaster");
	  MyPageFactory.getPage(driver, userRolePageClass.class).clickTeamTab()
	  .findTeam("Lacrosse Team Edit")
	  .scrollAndClickTeam(0,0,"//*[text()='Lacrosse Team Edit']");
	   
	   wait.until(visibilityOfElementLocated(By.name("sport")));
	   MyPageFactory.getPage(driver, newTeamPage.class).chooseTeamSport("Basketball");
	   MyPageFactory.getPage(driver, newTeamPage.class).chooseLeagueSport("Male Basketball League")
		 .chooseSchoolSport("Basketball University")
		 .addTeamName("Selenium Lacrosse Other Team Edit")
		 .saveTeam()
	
	  .findTeam("Selenium Lacrosse Other Team Edit")
	  .scrollAndClickTeam(0,0,"//*[text()='Selenium Lacrosse Other Team Edit']");
	  
	  wait.until(visibilityOfElementLocated(By.name("sport")));
	  driver.findElement(By.xpath("//*[text()='Basketball']")).getAttribute("selected");
	  driver.findElement(By.xpath("//*[text()='Male Basketball League']")).getAttribute("selected");
	  driver.findElement(By.xpath("//*[text()='Basketball University']")).getAttribute("selected");
	  
	  
	  MyPageFactory.getPage(driver, newTeamPage.class).chooseTeamSport("Lacrosse");
	   MyPageFactory.getPage(driver, newTeamPage.class).chooseLeagueSport("Lacrosse League")
		 .chooseSchoolSport("Lacrosse Other")
		 .addTeamName("Lacrosse Team Edit")
		 .saveTeam()
	
	  .findTeam("Lacrosse Team Edit")
	  .scrollAndClickTeam(0,0,"//*[text()='Lacrosse Team Edit']");
	  
	  wait.until(visibilityOfElementLocated(By.name("sport")));
	  driver.findElement(By.xpath("//*[text()='Lacrosse']")).getAttribute("selected");
	  driver.findElement(By.xpath("//*[text()='Lacrosse League']")).getAttribute("selected");
	  driver.findElement(By.xpath("//*[text()='Lacrosse Other']")).getAttribute("selected");
	  
	  
	  
	  
      
	  driver.get("https://www-dev.krossover.com/intelligence-qa/schools");
		 MyPageFactory.getPage(driver, internalPageClass.class).logout();
	}	
	
}


